package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsSeckillSession;
import com.wuxiaofan.coupon.entity.custom.SmsSeckillSessionCustom;
import com.wuxiaofan.coupon.mapper.SmsSeckillSessionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsSeckillSessionService {
    @Autowired
    private SmsSeckillSessionMapper smsSeckillSessionMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsSeckillSession findById(String id){
        return smsSeckillSessionMapper.selectById(id);
    }

    public SmsSeckillSessionCustom findCountByMap(Map paraMap){
        return smsSeckillSessionMapper.findCountByMap(paraMap);
    }

    public SmsSeckillSessionCustom findGroupByMap(Map paraMap){
        return smsSeckillSessionMapper.findGroupByMap(paraMap);
    }

    public List<SmsSeckillSessionCustom> findByMap(Map paraMap){
        return smsSeckillSessionMapper.findByMap(paraMap);
    }

    public Page<SmsSeckillSessionCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsSeckillSessionMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsSeckillSessionMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsSeckillSessionMapper.deleteById(id);
    }

    public SmsSeckillSession save(SmsSeckillSession smsSeckillSession){
        smsSeckillSession.setId(idgenerator.getId());
        smsSeckillSessionMapper.insert(smsSeckillSession);
        return smsSeckillSession;
    }

}
